package com.xueshishasha.oa.service.impl;

import java.io.Serializable;
import java.util.Collection;
import java.util.List;

import org.hibernate.criterion.DetachedCriteria;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.xueshishasha.oa.model.AddressBook;
import com.xueshishasha.oa.service.DataService;

public class AddressBookServiceImpl implements
		com.xueshishasha.oa.service.AddressBookService {
	
	private final Logger logger = LoggerFactory.getLogger(AddressBookServiceImpl.class);

	private DataService<AddressBook> dataService ;

	

	
	@Override
	public AddressBook getInfo(String id) {
		return this.getModelById(id);
	}


	@Override
	public void updateInfo(AddressBook addressBook) {
		this.update(addressBook);
	}
	
	@Override
	public Serializable save(AddressBook addressBook){
		return dataService.save(addressBook);
		
	}

	@Override
	public void delete(AddressBook addressBook) {
		dataService.delete(addressBook);

	}

	@Override
	public List<AddressBook> getAll() {
		String sql = "from AddressBook";
		return dataService.getModels(sql,null);
	}

	@Override
	public AddressBook getModelById(Serializable id) {
		return dataService.getModelById(AddressBook.class, id);
	}

	@Override
	public List<AddressBook> getModels(String hql, Object[] parameters) {
		return dataService.getModels(hql,parameters);
	}

	@Override
	public void saveOrUpdate(AddressBook addressBook) {
		dataService.saveOrUpdate(addressBook);
	}

	@Override
	public void saveOrUpdateAll(Collection<AddressBook> collection) {
		dataService.saveOrUpdateAll(collection);
	}

	@Override
	public void update(AddressBook addressBook) {
		dataService.update(addressBook);
	}
	
	@Override
	public List<AddressBook> getByCriteria(DetachedCriteria dc) {
		return dataService.getByCriteria(dc);
	}

	public DataService<AddressBook> getDataService() {
		return dataService;
	}

	public void setDataService(DataService<AddressBook> dataService) {
		this.dataService = dataService;
	}

	
}
